<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>网络监听接口</title>
	</head>
	<body>
		
		<script type="text/javascript">
			
			// online; 网络连通的时候触发
			window.addEventListener("online", function() {
				alert("网络连通了")
			});
			
			// ofline: 网络断开时候触发
			window.addEventListener("offline", function() {
				alert("网络断开了")
			});
			
		</script>
		
		
	</body>
</html>
